﻿@using System.Security.Principal;
<!DOCTYPE html>
<html>

<head>
    <meta content="IE=10.000" http-equiv="X-UA-Compatible">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta name="author" content="Super User">
    <title>eCollabro @ViewBag.Title</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/bootstrap")
    @Scripts.Render("~/bundles/angular")
    @Scripts.Render("~/bundles/eCollabro")
    @Scripts.Render("~/bundles/ecollabro-content")
    @Scripts.Render("~/bundles/esb")
    @RenderSection("scripts", required: false)
    <link rel="stylesheet" href="~/Content/jquery.treegrid.css">
    <script type="text/javascript" src="~/Scripts/jquery.treegrid.js"></script>
    <script type="text/javascript" src="~/Scripts/jquery.cookie.js"></script>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="GENERATOR" content="MSHTML 10.00.9200.16863">

    <link href="~/Content/jquery.cleditor.css" rel="stylesheet" />
    <script src="~/Scripts/jquery.cleditor.js"></script>

    <style type="text/css">
        #main-menu {
            position: relative;
            /*z-index: 9999;*/
            width: auto;
        }

            #main-menu ul {
                width: 12em; /* fixed width only please - you can use the "subMenusMinWidth"/"subMenusMaxWidth" script options to override this if you like */
            }
    </style>
    <script type="text/javascript">
        function SetLanguage(obj) {
            $.cookie("mylang", obj.value, { expires: 10, path: '/' });
            location.reload();
        }
        function SetTheme(theme) {
            $.cookie("mytheme", theme, { expires: 10, path: '/' });
            location.reload();
        }
        $(document).ready(function () {
            $.ajaxSetup({ cache: false });
        });
    </script>
</head>
@{
    var siteId = 1;
    var authToken = string.Empty;
    bool userAuthenticated = false;
    string user = string.Empty;
    if (System.Configuration.ConfigurationManager.AppSettings["SiteId"] != null)
    {
        siteId = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["SiteId"]);
    }

    if (Request.IsAuthenticated)
    {
        if (Session["SiteId"] != null)
        {
            siteId = Convert.ToInt32(Session["SiteId"]);

        }
        if (Session["AuthToken"] != null)
        {
            authToken = Convert.ToString(Session["authToken"]);
        }
        userAuthenticated = true;
        user = User.Identity.Name;
    }
}

<body ng-app="ecollabroApp">
    <div id="divApp" ng-controller="appController" ng-init="initialize(@siteId,'@userAuthenticated','@user','@authToken')">
        <div style="position: absolute; left: 45%;top:40%;" data-loading><div class="loading-spiner"><img src="~/Images/ajax-loader.gif" style="border:none" /></div></div>
        @Html.Partial("_ModalDialog")
        @{
            if (Session["SiteId"] == null && User.Identity.Name != null)
            {
                FormsAuthentication.SignOut();
                //Page.User.Identity.IsAuthenticated gets its value from Page.User which is read-only and is not updated when you call FormsAuthentication.SignOut()
                // now HttpContext.Current.User.Identity.IsAuthenticated == false
                // and Page.User.Identity.IsAuthenticated == false
                HttpContext.Current.User = new GenericPrincipal(new GenericIdentity(string.Empty), null);
            }
        }

        <div class="navbar container-fluid navbar-default" style="height:60px">

            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a href="/" class="navbar-brand"><img src="~/Images/logo.png" alt="Brand" /></a>
            </div>
            <div class="navbar-collapse collapse">
                @Html.Partial("_LoginPartial")
            </div>
        </div>
        <div id="userMenu" class="container-fluid"></div>
        <div id="divSummaryMessageHeader"></div>

        <div class="container body-content" style="min-height:450px">
            @RenderBody()
        </div>
        <hr />
        <footer>
            <p style="text-align:center">&copy; @DateTime.Now.Year -eCollabro</p>
        </footer>
        <hr />
        @*<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                 Sponser
                <ins class="adsbygoogle"
                     style="display:block"
                     data-ad-client="ca-pub-1083787643287719"
                     data-ad-slot="2137573182"
                     data-ad-format="auto"></ins>
                <script>
            (adsbygoogle = window.adsbygoogle || []).push({});
                </script>*@
    </div>
</body>
</html>
